Assume the DAC bean that has name "DAC". A external device is connected to the DAOx output
of this CPU. The DAC module allow to generate a sawtooth signal by SetChannel8 method
of the bean.
...
void main(void) {
byte i = 0; /* counter variable */
...
DAC1_Enable(); /* Enable DAC bean */
for(;;) {
if (i==255) { /* Set new value of the counter */
i=0;
} else {
i++;
}
DAC1_SetValue8(&i); /* Set level of the output signal
according to the value of i */
...
}
}
For more about typical usage of the bean code please refer to the page Bean Code Typical Usage.